package com.fulihui.systemcore.dal.convertor;

import com.fulihui.systemcore.dal.dataobj.ApiTemplate;
import com.fulihui.systemcore.dto.ApiTemplateDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by  lz on 2017-5-31.
 */
public class ApiTemplateConv  {




    private static final String[] ignore = {  };

    public static ApiTemplate convert2DO(ApiTemplateDTO mo_) {
        if (mo_ == null) {
            return null;
        }

        ApiTemplate do_ = new ApiTemplate();
        BeanUtils.copyProperties(mo_, do_, ignore);

        return do_;
    }

    public static ApiTemplateDTO convert2DTO(ApiTemplate do_) {
        if (do_ == null) {
            return null;
        }

        ApiTemplateDTO mo_ = new ApiTemplateDTO();
        BeanUtils.copyProperties(do_, mo_, ignore);

        return mo_;
    }

    public static List<ApiTemplateDTO> convert2List(List<ApiTemplate> list) {
        return list.stream().map(ApiTemplateConv::convert2DTO).collect(Collectors.toList());
    }
}
